/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.ExtraStructuredActivities;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;


import edu.pku.sei.modeler.model.uml.StructuredActivities.StructuredActivityNode;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class ExpansionRegion extends StructuredActivityNode implements IExpansionRegion {
	// attributes
	
	protected ExpansionKind mode;
	
	
	
	
	// references
	
	protected MetaTypedList inputElement;
	
	protected MetaTypedList outputElement;
	
	
	
	// getters & setters for attributes
	
	public ExpansionKind getMode() {
		return mode;
	}
	public void setMode(ExpansionKind newMode) {
		ExpansionKind oldmode = mode;
		mode = newMode;
		firePropertyChange(ModelPackage.EXPANSIONREGION_MODE, oldmode, newMode);
	}
	
	// getters for references
	
	public MetaTypedList getInputElement() {
		if(inputElement == null) {
			inputElement = new MetaTypedList(ExpansionNode.class, this, ModelPackage.EXPANSIONREGION_INPUTELEMENT);
		}
		return inputElement;
	}
	
	public MetaTypedList getOutputElement() {
		if(outputElement == null) {
			outputElement = new MetaTypedList(ExpansionNode.class, this, ModelPackage.EXPANSIONREGION_OUTPUTELEMENT);
		}
		return outputElement;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.EXPANSIONREGION_MODE, mode);
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.EXPANSIONREGION_INPUTELEMENT, inputElement);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.EXPANSIONREGION_OUTPUTELEMENT, outputElement);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		mode = (ExpansionKind)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.EXPANSIONREGION_MODE, this);
		
		// references
		
		this.getInputElement().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.EXPANSIONREGION_INPUTELEMENT, this));
		
		this.getOutputElement().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.EXPANSIONREGION_OUTPUTELEMENT, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		else if(ModelPackage.EXPANSIONREGION_MODE.equals(featureID)) {
			mode = (ExpansionKind)value;
		}
		
		// references
		
		else if(ModelPackage.EXPANSIONREGION_INPUTELEMENT.equals(featureID)) {
			getInputElement().add(value);
		}
		
		else if(ModelPackage.EXPANSIONREGION_OUTPUTELEMENT.equals(featureID)) {
			getOutputElement().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 